package Week1.J0419;

// 解法1: 链表 / 数组模拟
// 解法2: 递推 / 递归 / 动态规划
public class 孩子们的游戏_xv {

    public int LastRemaining_Solution(int n, int m) {
        int f = 0; // dp[1]
        for (int i = 2; i <= n; i++) {
            f = (f + m) % i;
        }
        return f;
    }
}
